package com.cqhfan.core.autoconfigure.mvc;

import com.cqhfan.core.autoconfigure.mvc.advice.GlobalExceptionHandler;
import com.cqhfan.core.autoconfigure.mvc.advice.GlobalResponseHandler;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.DispatcherServlet;

@Configuration
@ConditionalOnClass(DispatcherServlet.class)
public class MvcConfig {

    @Bean
    public GlobalExceptionHandler globalExceptionHandler() {
        return new GlobalExceptionHandler();
    }

    @Bean
    public GlobalResponseHandler globalResponseHandler() {
        return new GlobalResponseHandler();
    }

}
